include('shared.lua')
include("cl_postprocess.lua")

FontResize = (ScrW()/1024)

surface.CreateFont("akbar",FontResize*15,400,true,false,"ScoreFont");

function DrawBar()
	
	draw.RoundedBox(8, 0, 5, ScrW(), 50, Color(0, 0, 0, 100))

end

function DrawHealth()

	if LocalPlayer():Health() == nil or LocalPlayer():Health() <= 0 then return end
	
	draw.RoundedBox(6, 5, 20, math.Clamp(LocalPlayer():Health(), 0, 100 ) * 2, 20, Color(255, 50, 50, 255))
	
	draw.DrawText("Health", "ScoreFont", math.Clamp(LocalPlayer():Health(), 0, 100 ), 16, Color(255, 255, 255, 255), 1)
	
end

function DrawTime()
	local timeleft = (GAMEMODE.GameLength * 60) - CurTime()
	
	if timeleft <= 0 then
		timeleft = 0
	end
	
		draw.DrawText("Time Left to fight!", "ScoreFont", ScrW() / 2, 5, Color(255, 255, 255, 255), 1)
		draw.DrawText(string.ToMinutesSeconds(timeleft), "ScoreFont", ScrW() / 2, 30, Color(255, 255, 255, 255), 1)
end

function DrawRemaining()
	
	draw.DrawText("Models Remaining", "ScoreFont", ScrW() - 150, 5, Color(255, 255, 255, 255), 1)
	
	draw.DrawText(LocalPlayer():GetNWInt("remainingmodels"), "ScoreFont", ScrW() - 150, 25, Color(255, 255, 255, 255), 1)
	
end

function DrawClass()

	if LocalPlayer():Team() == 1 then PlClass = "RED" end;
	if LocalPlayer():Team() == 2 then PlClass = "BLUE" end;
	if LocalPlayer():Team() != 1 or LocalPlayer():Team() != 2 then return end;
	
	draw.DrawText("Class", "ScoreFont", ScrW() - 470, 5, Color(255, 255, 255, 255), 1)
	draw.DrawText(PlClass, "ScoreFont", ScrW() - 470, 25, Color(255, 255, 255, 255), 1)
	
end

function DrawRespawn()
	
	timeLeft = math.Round(StartTime - RespawnTime)
	timeLeftReversal = GAMEMODE.MaximumDeathLength - timeLeft
	timeLeft = timeLeftReversal
	
	if timeLeft <= 0 then
		RecieveNotify( LocalPlayer(), "Respawning now!", 5 )
	else	
		RecieveNotify( LocalPlayer(), "Respawn in " .. timeLeft, 5 )
	end
	
end

--function GM:HUDPaint()
	--DrawBar()
	--DrawHealth()
	--DrawTime()
	--DrawRemaining()
--	if !LocalPlayer():Alive() then
	--	StartTime = CurTime()
	--	RespawnTime = LocalPlayer():GetNWInt("DeathTime")
	--	DrawRespawn()
	--end
--end
